public class Text8 {
    // 剑指offer 53 - II. 0~n-1中缺失的数字
    public int missingNumber(int[] nums) {
        int left = 0, right = nums.length - 1;
        while(left < right){
            int mid = left + (right - left)/2;
            if (nums[mid] == mid)
                left = mid + 1;
            else
                right = mid;
        }
        return nums[left] == left ? left + 1:left;
    }
}
